package mvp.com.bbc.rcjavaretrofitdaggermvp.app.utils;

import mvp.com.bbc.rcjavaretrofitdaggermvp.app.BaseApplication;
import mvp.com.bbc.rcjavaretrofitdaggermvp.app.contact.StateConstant;

/**
 * Created by Administrator on 2017/8/31.
 */

public class NetWorkStateUtil {
    private static NetWorkStateUtil netWorkStateUtil;
    private NetWorkStateUtil(){

    }
    public static NetWorkStateUtil getNetWorkStateUtil(){
        if(netWorkStateUtil==null){
            synchronized (NetWorkStateUtil.class){
                if (netWorkStateUtil==null){
                    netWorkStateUtil = new NetWorkStateUtil();
                }
            }
        }
        return netWorkStateUtil;
    }

    public <T>T getPresenterNetWork(T t){
        if (StateConstant.NetWork_Connect){
            return t;
        }else {
            ToastUtlis.ToastShow_Short(BaseApplication.getContext(),"没有网啦");
            return null;
        }
    }
}
